﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第126题
//BC128 小乐乐计算求和
//https://www.nowcoder.com/practice/c98aeab2362c459dbc840d4c75f07729?tpId=107&tqId=33409&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D3%26tpId%3D107%26type%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include <stdio.h>

int Fun(int n)
{
    if (n <= 2)
        return n;
    else
        return n * Fun(n - 1);
}

int main() {
    int sum = 0;
    int n = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        sum += Fun(i);
    }

    printf("%d", sum);

    return 0;
}